﻿using log4net;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace WeighClient.Utils
{
    public static class LogObject
    {
        public static ILog Log(string LoggerName)
        {
            //log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
            return LogManager.GetLogger(LoggerName);
        }

        public static void WriteLog(string exp = null, string level = "Info", string loggerName = "InfoLogger")
        {
            if ("Debug".Equals(level))
            {
                LogObject.Log(loggerName).Debug(exp);
            }
            else if ("Error".Equals(level))
            {
                LogObject.Log(loggerName).Error(exp);
            }
            else if ("Info".Equals(level))
            {
                LogObject.Log(loggerName).Info(exp);
            }
            else
            {
                LogObject.Log(loggerName).Debug(exp);
            }
        }
    }
}
